
import java.util.ArrayList;
import java.util.List;
public class TestShallowPrototype {

    public static void main(String[] args) {

        ShallowPrototype shallowPrototype = new ShallowPrototype();

        shallowPrototype.setAge(18);
        shallowPrototype.setName("张三");
        List<String> phoneList = new ArrayList<>();
        phoneList.add("111111111");
        shallowPrototype.setPhoneList(phoneList);

        ShallowPrototype cloneShallowPrototype = (ShallowPrototype) shallowPrototype.clone();

        System.out.println(shallowPrototype.getPhoneList());
        System.out.println(cloneShallowPrototype.getPhoneList());
        System.out.println(shallowPrototype.getPhoneList() == cloneShallowPrototype.getPhoneList());

        List<String> list = shallowPrototype.getPhoneList();
        list.add("22222222222");

        System.out.println(shallowPrototype.getPhoneList());
        System.out.println(cloneShallowPrototype.getPhoneList());
        System.out.println(shallowPrototype.getPhoneList() == cloneShallowPrototype.getPhoneList());

        // List list1 = new ArrayList();
        // list1.add("xxxxxxxxxxxx");
        // shallowPrototype.setPhoneList(list1);

        // System.out.println(shallowPrototype.getPhoneList());
        // System.out.println(cloneShallowPrototype.getPhoneList());
        // System.out.println(shallowPrototype.getPhoneList() == cloneShallowPrototype.getPhoneList());


    }
}